//
//  ChatMessage.h
//  DDKelai
//
//  Created by Admin on 15/10/19.
//  Copyright (c) 2015年 chenwenhao. All rights reserved.
//

#import <Foundation/Foundation.h>


@interface ChatMessageList : NSObject

@property (nonatomic, strong) NSArray *chatMessagegArr;

+ (ChatMessageList *)chatMessageListFromData:(NSArray *)list;

@end


@interface ChatMessage : NSObject

//数据库自增ID
@property (nonatomic,copy) NSString *dbId;

//消息Id
@property (nonatomic,strong) NSString *msgId;

//发送者
@property (nonatomic,strong) NSString *sender;

//发送时间
@property (nonatomic,strong) NSString *sendTime;

//时间分割线
@property (nonatomic,strong) NSString *splitTime;

//实际显示的消息内容
@property (nonatomic,copy) NSString *displayMsg;

//文本内容
@property (nonatomic,strong) NSString *msgContent;//messageBodyType为TEXT有效

//图文消息中的具体内容
@property (nonatomic,copy) NSString *detailContent;

//图文消息的跳转链接
@property (nonatomic,copy) NSString *msgUrl;

// 商品原价
@property (nonatomic,copy) NSString *rawPrice;

// 商品特价
@property (nonatomic,copy) NSString *discountPrice;

//messageBodyType为PIC_URL和VOICE有效,表示资源服务器上的存盘\;根路径
@property (nonatomic,strong) NSString *mediaPath;

//图片和语音的本地存储路径
@property (nonatomic,strong) NSString *contentPath;

//语音长度
@property (nonatomic,strong) NSString *voiceLength;

//消息来源: 发送、接收
@property (nonatomic,assign) ChatMsgType msgSourceType;

//消息内容类型
@property (nonatomic,assign) ChatMsgBodyType messageBodyType;

//消息发送状态
@property (nonatomic,assign) ChatMsgState messageState;

//有图片语音下载才有这个属性
@property (nonatomic,assign) ChatMsgMediaState mediaStatus;

//消息阅读状态
@property (nonatomic,assign) ChatMsgReadState readStatus;

// 用户自定义字段
@property (nonatomic,copy) NSString *userData;

@property (nonatomic,assign)CGFloat imageHeight;

@property (nonatomic,assign)CGFloat imageWidth;


#pragma mark - 非数据库字段
//自己是不是发送者，只有两种角色<发送者、接收者,
@property (nonatomic,assign)BOOL senderIsSelf;

//聊天的对象
@property (nonatomic,strong)NSString *toFriendid;

@property (nonatomic,strong)NSString *toFriendName;

@property (nonatomic,strong)NSString *toFriendLogo;


//将FMResultSet对象转换成ChatMessage对象
+ (ChatMessage *)ChatMessageDataFromDB:(FMResultSet *)rs;

//将NSDictionary对象转换成ChatMessage对象
+ (ChatMessage *)ChatMessageDataFromDic:(NSDictionary *)dic;


@end
